home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 15
/
Aminet 15 - Nov 1996.iso
/
Aminet
/
comm
/
bbs
/
ChkAmCD101.lha
/
ChkCD.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1996-09-07
|
4KB
|
142 lines
/* ChkCD.rexx */
/* By Gnome (John Marchant)
Fidonet: 2:2500/167.15
Moonlight BBS, Bedford UK. +44 1234 212752
Open 6pm to 8am ONLY, including weekends.
Fax, netmail & Freq accepted during open hours.
Usage: Load Aminet CD in drive CD0:
rx ChkCD [f/?]
(argument f causes report to be copied to file ram:CDcheck)
(argument ? only displays purpose of program)
This program is public domain & carries no warranty
*/
/*
$VER: ChkCD.rexx 1.01 (07 Sep 1996) by Gnome
*/
options results
/*
call open('STDERR','rad:tracefile','w')
trace results
*/
arg tofile
if tofile = '?' then do
say
say 'This arexx program has 2 phases:'
say '1. It scans CD0:aminet/TREE, and checks that all directories'
say ' listed in TREE exist on the CD, and are not empty.'
say
say '2. It scans CD0:aminet/INDEX, and checks that all directories'
say ' and files listed in INDEX do in fact exist.'
say
say 'Missing files or directories, and empty directories are reported'
say 'on screen. If argument ''f'' is supplied, the report is also'
say 'written to RAM:CDcheck. e.g. rx ChkCD f'
say
say 'The program may be stopped at any time with Ctrl-C.'
say
exit 0
end
If ~Show('L','rexxsupport.library') Then Do
If ~AddLib('rexxsupport.library',0,-30,0) Then Do
print 'RexxSupport.Library missing! Can''t continue...'
Exit 10
End
End
if open('tr','CD0:aminet/TREE','r')=0 then do
say 'Can''t open CD0:aminet/TREE. Sure the right CD is loaded in CD0?'
say
exit 20
end
report=0
if upper(tofile)='F' then do
call open('op','ram:CDcheck','w')
list=showlist('V') /* Identify CD name, for report title */
x=index(list,'AMINET')
if x>0 then do
y=substr(list,x)
z=word(y,1)
call writeln('op','Check on CD '||z||' on '||date()) /* Report title */
call writeln('op','')
end
report=1
end
do while ~eof('tr')
line = readln('tr')
if line = '' | left(line,1)=' ' then iterate
first = trim(word(line,1))
uf = upper(first)
if uf='NEW' | uf='PRIV' | uf='RECENT' then iterate
if index(first,'/')=0 then iterate
if ~exists('CD0:aminet/'||first) then do
hold='Directory Aminet/'||uf||' does not exist'
say hold
if report=1 then call writeln('op',hold)
iterate
end
comline = 'list >ram:test '||'CD0:aminet/'||first
address command comline
call open('rt','ram:test','r')
t=readln('rt')
call close('rt')
if index(t,'empty')>0 then do
hold='Directory Aminet/'||first||' is empty'
say hold
if report=1 then call writeln('op',hold)
iterate
end
end
call close('tr')
call delete('ram:test')
say
say 'TREE checked. Now checking INDEX.'
say
if open('ind','CD0:aminet/INDEX','r')=0 then do
say 'Can''t open CD0:aminet/INDEX. Abandoning run'
say
exit 20
end
do while ~eof('ind')
line = readln('ind')
if line = '' | left(line,1)='|' | left(line,1)=' ' then iterate
fname = strip(word(line,1))
fpath = strip(word(line,2))
fullpath = 'CD0:aminet/'||fpath
if ~exists(fullpath) then do
hold='Directory Aminet/'||fpath||' does not exist'
say hold
if report=1 then call writeln('op',hold)
iterate
end
file = fullpath||'/'||fname
if ~exists(file) then do
hold='File '||fpath||'/'||fname||' does not exist'
say hold
if report=1 then call writeln('op',hold)
iterate
end
end
call close('ind')
if report=1 then call close('op')
say
say 'End of check.'
if report=1 then say 'Report is on file ram:CDcheck'
say